package cn.usts.softwareengineering;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class MapMain {
    public static void main(String[] args) {
        Map<String, Integer> apple=new HashMap<>();
        apple.put("Lucy",5);
        apple.put("Lily",4);
        apple.put("HanMeimei",5);
        apple.put("Jim",3);
        apple.put("ZouEncen",3);
        apple.put("Dongqiangqiang",5);
        System.out.println("-------------指定Key输出-------------");
        System.out.println("Enceng老师对苹果的喜爱程度为："+apple.get("ZouEncen"));
        System.out.println("Dongqiangqiang对苹果的喜爱程度为："+apple.get("Dongqiangqiang"));
        System.out.println("-------------循环迭代输出-------------");
        //循环迭代
        Iterator iter=apple.entrySet().iterator();
        while (iter.hasNext()){
            System.out.println(iter.next());
        }

    }
}
